home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / Asymptote Demo / Examples / Demos / 1&2) Errorbars / Demo1 next >
Encoding:
Text File  |  1994-05-07  |  1.2 KB  |  33 lines  |  [TEXT/DWat]

  1. % Asymptote demo #1
  2. % Plot a basic linear graph of y=x^2 with error bars
  3.  
  4. graphunits in            % Use inches to measure page coordinates
  5. graphframe 2 7 2 7    % Set the location of the graph on the page
  6. fontname Times            % Change to the Times font for the graph
  7.  
  8. % Calculate y = x*x for x = 1 to 25
  9. npts 25                    % We will calculate 25 points
  10. rpn index >x            % Put 1,2,3,4...25 into the x vector
  11. rpn <x <x * >y            % Find the square of the x vector
  12. rpn 50 >e                % Put a constant error of 50 into the e vector
  13.  
  14. graphlimits                % Set the graph limits to show all of the points
  15. graphticks                % Choose the tick spacing automatically
  16. drawframe                % Draw the frame around the graph
  17. scale 1.5                % Make the scale factor bigger and draw the axis labels
  18. drawtitle Linear Graph with Error Bars
  19. drawxlabel X axis
  20. drawylabel Y axis
  21.  
  22. pointsymbol 4 filled    % Choose filled squares for the point symbols
  23. scale 1.5                % Draw big points
  24. plotpoints
  25. scale 1                    % Set the scale factor back
  26. pensize 1                 % Set up to draw 1 point thick line
  27. plotline                 % Plot the line
  28. pensize .25                % Set up for hairlines
  29. ploterrors bottom        % Draw error bars on the bottom of the points
  30. ploterrors top            % Draw error bars on top
  31.  
  32. fullscreen
  33. showgraph